package fauxman.interfaces;

import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

import fauxman.model.WorldModel;

public abstract class DynamicElement extends GameElement{
	protected int conX;	// continuous X
	protected int conY;	// continuous Y
	protected int width;
	protected int height;
	protected int disX;
	protected int disY;
	
	public abstract void draw(Graphics g);
	public void collide(WorldModel model, DynamicElement de){
		
	}
	
	public void setContinuousPosition(Point p){
		Rectangle r = this.getConHitbox();
		r.setLocation(((int)p.getX() - this.conX) + (int)r.getX(), ((int)p.getY() - this.conY) + (int)r.getY());
		this.setConHitbox(r);
		this.conX = (int)p.getX();
		this.conY = (int)p.getY();
	}
	
	public Point getContinuousPosition(){
		return new Point(this.conX, this.conY);
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public void setDiscretePosition(Point p) {
		this.disX = (int)p.getX();
		this.disY = (int)p.getY();
		
	}

	public Point getDiscretePosition() {
		return new Point(this.disX, this.disY);
	}

}